<template>
  <el-container class="app-container">
    <TheHeader />
    <el-container class="main-layout-container">
      <TheSidebar />
      <el-main class="content">
        <router-view v-slot="{ Component }">
          <transition name="fade" mode="out-in">
            <component :is="Component" />
          </transition>
        </router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import TheHeader from '@/components/TheHeader.vue'
import TheSidebar from '@/components/TheSidebar.vue'
</script>

<style scoped>
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-layout-container {
  display: flex;
  flex-grow: 1;
  height: calc(100vh - 56px);
  background-color: #ffffff;
  position: relative;
}

.content {
  flex-grow: 1;
  padding: 24px 32px;
  overflow-y: auto;
  margin-left: 200px;
  max-width: 1600px;
  width: calc(100% - 200px);
  transition: all 0.3s;
  background-color: #ffffff;
}

/* 自定义滚动条样式 */
.content::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .content {
    margin-left: 0;
    padding: 16px;
    width: 100%;
    max-width: 100%;
  }
}

/* 路由切换动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>